
	******************************************************************
	**
	**
	**		NAME:		GUY GROSSMAN, YOTAM MARGALIT, TAMAR MITTS
	**		DATE: 		December 15, 2021
	**		PROJECT: 	Israel Hayom
	**		DETAILS: 	This code generates Table SI-17
	**		Version: 	Stata MP 16
	**
	******************************************************************
	
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**

clear
version 16
set scheme plotplain
set more off

capture cd "~/dropbox/Israeli Newspapers Study/JOP_REPLICATION/Dataverse submission"

* bring in period dataset at locality level

use "Data/yeshuv_period_final_Figs.dta", clear
tsset uniqueid period
sort uniqueid period
	
* Defining covariates

gl interactions i.period#c.ltd i.period#c.lpop i.period#c.matriccert_pcnt_08 i.period#c.europe_pcnt_08 i.period#c.pop_share1829 i.period#c.pop_share3049 i.period#c.pop_share5065 i.period#c.pop_share66 i.period#c.religion_pcnt i.period#c.asia_pcnt_08
su $interactions

gl covs ltd lpop matriccert_pcnt_08 europe_pcnt_08 pop_share1829 pop_share3049 pop_share5065 pop_share66 asia_pcnt_08 religion_pcnt
su $covs

**********************************		
* Regressions on Turnout results *
**********************************

estimates drop _all

* Turnout heterogenous effects - left localities - No covariates

bootstrap, reps(250) seed(1712) cl(area_num) idcl(new_area_num) group(uniqueid) force:  reghdfe turnout IHE [aw=potential] if BRBCat==1, absorb(uniqueid period) cl(area)
			estadd local typeT "Left"
			estadd local ModelT "2WFE"
			estadd local covs "No"
			capture est sto Hetturnout1
			
* Turnout heterogenous effects - left localities - With covariates

bootstrap, reps(250) seed(1712) cl(area_num) idcl(new_area_num) group(uniqueid) force: reghdfe turnout IHE $interactions [aw=potential] if BRBCat==1, absorb(uniqueid period) cl(area)
			estadd local typeT "Left"
			estadd local ModelT "2WFE"
			estadd local covs "Yes"
			capture est sto Hetturnout2
			
* Turnout heterogenous effects - center localities - No covariates
	
bootstrap, reps(250) seed(1712) cl(area_num) idcl(new_area_num) group(uniqueid) force: reghdfe turnout IHE [aw=potential] if BRBCat==2, absorb(uniqueid period) cl(area)
			estadd local typeT "Center"
			estadd local ModelT "2WFE"
			estadd local covs "No"	
			capture est sto Hetturnout3

* Turnout heterogenous effects - center localities - With covariates
	
bootstrap, reps(250) seed(1712) cl(area_num) idcl(new_area_num) group(uniqueid) force: reghdfe turnout IHE $interactions [aw=potential] if BRBCat==2, absorb(uniqueid period) cl(area)
			estadd local typeT "Center"
			estadd local ModelT "2WFE"
			estadd local covs "Yes"	
			capture est sto Hetturnout4

* Turnout heterogenous effects - right localities - No covariates
	
bootstrap, reps(250) seed(1712) cl(area_num) idcl(new_area_num) group(uniqueid) force: reghdfe turnout IHE [aw=potential] if BRBCat==3, absorb(uniqueid period) cl(area)
			estadd local typeT "Right"
			estadd local ModelT "2WFE"
			estadd local covs "No"	
			capture est sto Hetturnout5

* Turnout heterogenous effects - right localities - With covariates

bootstrap, reps(250) seed(1712) cl(area_num) idcl(new_area_num) group(uniqueid) force: reghdfe turnout IHE $interactions [aw=potential] if BRBCat==3, absorb(uniqueid period) cl(area)
			estadd local typeT "Right"
			estadd local ModelT "2WFE"
			estadd local covs "Yes"	
			capture est sto Hetturnout6

* Turnout heterogenous effects - pooled localities - No covariates

bootstrap, reps(250) seed(1712) cl(area_num) idcl(new_area_num) group(uniqueid) force: reghdfe turnout IHE [aw=potential] , absorb(uniqueid period) cl(area)
			estadd local typeT "Pooled"
			estadd local ModelT "2WFE"
			estadd local covs "No"	
			capture est sto Hetturnout7

* Turnout heterogenous effects - pooled localities - With covariates

bootstrap, reps(250) seed(1712) cl(area_num) idcl(new_area_num) group(uniqueid) force: reghdfe turnout IHE $interactions [aw=potential] , absorb(uniqueid period) cl(area)
			estadd local typeT "Pooled"
			estadd local ModelT "2WFE"
			estadd local covs "Yes"	
			capture est sto Hetturnout8
			
	* Outsheeting results to create Table SI-17
	
	# delimit ;
		esttab Hetturnout* 
		using "Tables/Table_SI-17.tex", replace
		keep(IHE _cons)
		cells(b(fmt(%5.3f) star) se(fmt(%5.3f) par))
		starlevels(* .10 ** .05 *** .01) 
		mgroups("\textbf{Left localities}" "\textbf{Centerist localities}" "\textbf{Right localities}" "\textbf{All localities}", pattern(1 0 1 0 1 0 1 0)
		span prefix(\multicolumn{@span}{c}{) suffix(}) erepeat(\cmidrule(lr){@span})) nomtitles
		varlabels(IHE "IH exposure" _cons "Constant")
		stats(typeT covs r2 N, labels("Sample" "Covariates" "R2" "N")
		fmt(0 0 2 0)) collabels(none) label booktabs nonotes
		;
		
		#delimit cr		
